<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>基于SSM的英语单词背诵系统</title>
    <meta name="description" content="Ela Admin - HTML5 Admin Template">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="apple-touch-icon" href="https://i.imgur.com/QRAUqs9.png">
    <link rel="shortcut icon" href="https://i.imgur.com/QRAUqs9.png">

    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/normalize.css@8.0.0/normalize.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.1.3/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/lykmapipo/themify-icons@0.1.2/css/themify-icons.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/pixeden-stroke-7-icon@1.2.3/pe-icon-7-stroke/dist/pe-icon-7-stroke.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.2.0/css/flag-icon.min.css">
    <link rel="stylesheet" th:href="@{/static/css/cs-skin-elastic.css}">
    <link rel="stylesheet" th:href="@{/static/css/style.css}">

    <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,600,700,800' rel='stylesheet' type='text/css'>



</head>

<body>






<div th:replace="common/leftbar::leftbar"></div>



<div id="right-panel" class="right-panel">

    <!-- Header-->
    <!-- Header-->
    <div th:replace="common/header::header"/>

    <div class="breadcrumbs">
        <div class="breadcrumbs-inner">
            <div class="row m-0">
                <div class="col-sm-4">
                    <div class="page-header float-left">
                        <div class="page-title">
                            <h1>当前位置</h1>
                        </div>
                    </div>
                </div>
                <div class="col-sm-8">
                    <div class="page-header float-right">
                        <div class="page-title">
                            <ol class="breadcrumb text-right">
                                <li><a href="#">主页</a></li>
                                <li><a href="#">学习中心</a></li>
                                <li class="active">搜单词</li>
                            </ol>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="content">
        <div class="row">
            <div class="col-lg-6">
                <div class="card">
                    <div class="card-header">搜单词</div>
                    <div class="card-body card-block">
                        <div class="login-form">
                            <form th:action="@{/Search}" method="post">
                                <div class="form-group" >
                                    <i class="fa fa-search" aria-hidden="true"></i>
                                    <label>搜索单词</label>
                                    <input type="text" class="form-control"  name="word" placeholder="word" required>
                                </div>
                                <button type="submit" class="btn btn-primary btn-flat m-b-30 m-t-30">搜索</button>
                            </form>
                        </div>
<!--                        <div th:text=${word}>-->
<!--                            同EL表达式有些相似的效果，如果有数据，被替换-->
<!--                            完成前后端分离效果(美工代码)-->
<!--                        </div>-->
                    </div>
                </div>
            </div>
            <div class="col-lg-6">
                <div class="card">
                    <div class="card-header">搜解释</div>
                    <div class="card-body card-block">
                        <div class="login-form">
                            <form th:action="@{/searchExplanation}" method="post">
                                <div class="form-group" >
                                    <i class="fa fa-search" aria-hidden="true"></i>
                                    <label>搜索解释</label>
                                    <input type="text" class="form-control"  name="explanation" placeholder="例子" required>
                                </div>
                                <button type="submit" class="btn btn-primary btn-flat m-b-30 m-t-30">搜索</button>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="card">
            <div th:if="${word != null}">
                <div class="card-header">
                    <h2 th:text="${word.getWordName()}">CET4 </h2>
                    <button  onclick="playAudio()" th:text="${word.getAudio()}">[apple]</button>
                    <audio id='audioPlay' src='http://dict.youdao.com/speech?audio=mild' th:value="${word.getWordName()}"/>
                </div>
                <div class="card-body " id="body">
                    [[${word.getExplanation()}]]
                    <br>
                    <hr>
                    <br>
                    例句：[[${word.getExample()}]]
                </div>
            </div>
        </div>
        <div class="card">
            <div th:if="${result_words != null}">
                <table class="table table-layout:fixed" >
                    <thead>
                    <tr>
                        <th scope="col">搜索结果</th>
                    </tr>
                    </thead>
                    <tbody>
                    <style type="text/css">.table {table-layout:fixed}</style>
                    <tr th:each="word:${result_words}">
                        <td>
                            <div class="card-header">
                                <h2 th:text="${word.getWordName()}">CET4 </h2>
                                <button  onclick="playAudio()" th:text="${word.getAudio()}">[apple]</button>
                                <audio id='audioPlay' src='http://dict.youdao.com/speech?audio=mild' th:value="${word.getWordName()}"/>
                            </div>
                            <div class="card-body " id="body">
                                [[${word.getExplanation()}]]
                                <br>
                                <hr>
                                <br>
                                例句：[[${word.getExample()}]]
                            </div>
                        </td>
                    </tr>

                    </tbody>
                </table>

            </div>
        </div>
    </div><!-- .content -->

    <div class="clearfix"></div>

    <div th:replace="common/footer::footer"/>


</div><!-- /#right-panel -->


<script src="https://cdn.jsdelivr.net/npm/jquery@2.2.4/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.14.4/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.1.3/dist/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery-match-height@0.7.2/dist/jquery.matchHeight.min.js"></script>
<script th:src="@{/static/js/main.js}"></script>
</body>
</html>